
import { _decorator, Component, Node, log } from 'cc';
import { DEBUG } from 'cc/env';
const { ccclass, property } = _decorator;

@ccclass('Main')
export class Main extends Component {

    @property(ButtonPlus)
    buttonPlus: ButtonPlus | null = null;
    @property(TouchPlus)
    touchPlus: TouchPlus | null = null;
    @property(Node)
    ndMatrix: Node | null = null;

    onLoad () {
        EventCenter.on("Event_Login", (a: number, b: number, c: number) => {
            console.log("Event ", a, b, c);
        }, this);
    }

    start () {
        if (DEBUG) {
            DebugWindowUtil.init();
        }

        // UILogin.openView(1, 2, 3);
        UILight.openView();
        // TipsMgr.inst.setLoadingForm("UIForms/UILoading");
        // UILogin.openView(1, 2, 3);
        this.buttonPlus.addClick(() => {
            log("点击事件!");
        }, this);

        this.buttonPlus.addLongClick(() => {
            log("触发长按事件 开始");
        }, () => { 
            log("触发长按事件 结束");
        }, this);

        this.touchPlus.addEvent((e) => {
            console.log('触发点击事件');
        }, (e) => {
            console.log('触发滑动事件', e.getDelta());
        })

        console.log(this.ndMatrix)
    }

    onDestroy() {
        log('destory');
    } 
}

